[WIP] builtextend: produce a squashfs artifact#261
[WIP] builtextend: produce a squashfs artifact#261lucab wants to merge 1 commit intocoreos:masterfrom
Conversation
This adds support for building a squashfs rootfs image. It can be directly run by `systemd-nspawn` or later assembled into ISO/PXE artifacts.
|
I didn't test this thoroughly, but @dustymabe was interested in it. |
|
yep. will mark WIP for now. I was interested in the steps and this should allow me to look through. Thanks @lucab |
| '-f', 'ext2', | ||
| '-o', f"{vmbuilddir}"]) | ||
|
|
||
| nproc = multiprocessing.cpu_count() |
There was a problem hiding this comment.
| '-drive', f"if=none,id=drive-scsi0-0-0-1,discard=unmap,file={workdir}/cache/cache.qcow2", | ||
| '-device', 'scsi-hd,bus=scsi0.0,channel=0,scsi-id=0,lun=1,drive=drive-scsi0-0-0-1,id=scsi0-0-0-1', | ||
| '-virtfs', f"local,id=workdir,path={workdir},security_model=none,mount_tag=workdir", | ||
| '-serial', 'stdio', '-append', 'root=/dev/sda console=ttyS0 selinux=1 enforcing=0 autorelabel=1']) |
There was a problem hiding this comment.
Hopefully a next step after this would be to rewrite runcompose()/runvm() to use this instead.
| vmpreparedir = f"{workdir}/tmp/supermin.prepare" | ||
| if os.path.isdir(vmpreparedir): | ||
| shutil.rmtree(vmpreparedir) | ||
| os.makedirs(vmpreparedir, exist_ok=True) |
There was a problem hiding this comment.
An ensure_empty_dir() in cmdlib.py would make sense.
| rpms = [] | ||
| with open(f"{libdir}/vmdeps.txt") as vmdeps: | ||
| for line in vmdeps: | ||
| if not line or line.startswith('#'): |
There was a problem hiding this comment.
I'd write if line == "" instead of if not line since I have been bitten in the past trying to remember how different languages coerce to booleans.
| script = f'''#!/usr/bin/env bash | ||
| set -xeuo pipefail | ||
| ostree checkout --repo {workdir}/repo/ {ref} /tmp/rootfs | ||
| /sbin/mksquashfs /tmp/rootfs {workdir}/{tmp_img} |
There was a problem hiding this comment.
This is just a stub right? The commit description says it's bootable this won't do that AFAICS.
This whole concept kind of depends on us reworking to use not-anaconda right?
There was a problem hiding this comment.
Yes and no.
This a basic ostree->squashfs conversion, and the resulting artifact can already be run by systemd-nspawn --volatile --boot (I wouldn't say it's bootable, as it doesn't contain any bootloader). No very interesting per se, but (possibly) an intermediate step towards re-using this rootfs for embeddeding in live PXE/ISO artifacts.
In that regard, this flow is already bypassing anaconda. It consumes an ostree ref and runs this build-extending script in a supermin VM.
|
(Overall, excellent code!) |
|
#738 is intended to supersede this. |
|
@bgilbert thanks for taking it over. Should we close this one then? Or is there an interest in publishing rootfs-as-squashfs on its own? (I thought I filed a ticket to track the latter question, but I'm not finding it right now) |
|
Let's close this, I think. We can always wrap a |
This adds support for building a squashfs rootfs image. It can be
directly run by
systemd-nspawnor later assembled into ISO/PXEartifacts.